<?php

class Application_Model_AttackPages
{
	protected $_roundSettings = "round_settings";
	protected $_race = "race";
	protected $_userStats = "user_stats";
		
	function getAttackList($power, $user_fk)
    {
    	$db = Zend_Db_Table::getDefaultAdapter();
    	$seletAttackPages = new Zend_Db_Select($db);
    	$seletAttackPages->from(array('us' => $this->_userStats))
    					 ->join(array('rs' => $this->_roundSettings), 'us.user_fk = rs.user_fk', array('alias'))
    					 ->join(array('r' => $this->_race), 'rs.race_fk = r.id', array('race_name'=>'name'))
    					 ->where('us.user_fk != ?',$user_fk)
    					 ->where('us.power >= ?',$power/2)
    					 ->where('us.power <= ?',$power*2)
    					 ->order('us.power DESC')
					 ->order('us.user_fk DESC');
    	return $seletAttackPages;
 	}
}


